package org.abstractmeta.commandify.core.command.collection;

import org.abstractmeta.commandify.core.CommandsImpl;
import org.abstractmeta.reflectify.Accessor;

import java.util.List;
import java.util.Map;

/**
 *
 */
public class ListCommands<T> extends CommandsImpl<T> {

    public ListCommands(Class<T> ownerType) {
        super(ownerType);
    }


    @Override
    @SuppressWarnings("unchecked")
    public Accessor<T, Object> getAccessor(final Object source) {
        Accessor accessor = new Accessor<List, Object>() {

            @Override
            public Object get(List instance) {
                return instance.get((Integer) source);
            }
        };
        return accessor;
    }


}
